#ifndef ADC_H
#define ADC_H

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ftd2xx.h>
#include <iostream>
#include <ftdi.h>

#define CTS 0x08  
#define RXD 0x02  
#define TXD 0x01  
#define RTS 0x04  

/* 
   CLK - RTS: 0x03
   DIN - TXD: 0x01
   DOUT- RXD: 0x05
   CS  - CTS: 0x0b
*/

class ADC
{

  public:
    ADC(char*);
    
    double calcTemp();
    double calcPress();
    
  private:
    int init(char*);
    void bitSequenceInit();
    void spiRead(unsigned char*);
    double calcVoltage(unsigned char*);
    
    FT_HANDLE handle;
    DWORD bytes;	
    
    unsigned char toSend[35];	
    
    bool initOk;

};

#endif
